﻿using System.Collections.Generic;
using System.Web.Mvc;
using DataServices;
using Model;
using System;

namespace LFWeb3.Controllers
{
    public class HomeController : Controller
    {
        DaoNews newsDao = new DaoNews();
        DaoNewsGroup newsGroupDao = new DaoNewsGroup();
        DaoArtWork arkWorkDao = new DaoArtWork();
        DaoSiteSearch siteSearchDao = new DaoSiteSearch();

        int pageSize = 20;


        /*---------------------前台页面---------------------------- */

        public ActionResult Index()
        {
            //取TopNews显示到首页
            IList<NewsInfo> topNews = newsDao.LoadNewsByPage(1, 8);
            ViewBag.TopNews = topNews;

            //取图片新闻 
            ViewBag.PictureNews = newsDao.LoadPictureNews();

            ViewBag.ArtWork = arkWorkDao.LoadTopWorkPic();

            return View();
        }


        public ActionResult Search(string keyword)
        {

            IList<SiteSearchInfo> result = siteSearchDao.Search(keyword);

            ViewBag.Result = result;



            return View();
        }


    }
}
